package asteroids.model.programs.parsing.expressions;

import java.util.Map;

import asteroids.model.Ship;
import asteroids.model.programs.parsing.types.DoubleLiteral;
import asteroids.model.programs.parsing.types.Type;

/**
 * A class of get direction expressions.
 * A get direction expression returns the direction of a ship.
 * 
 * @author Thijs Dieltjens - Wim Konings
 * @version 2.0
 */
public class getDirectionExpr extends NullaryExpression {

	public getDirectionExpr(int line, int column) {
		super(line, column);
	}

	@Override
	public Type eval(Ship ship, Map<String, Type> globals) {
		if(ship!=null){
			return new DoubleLiteral(ship.getDirection());
		}
		else{
			return new DoubleLiteral();
		}
	}
}
